package com.tianruan.dc.modules.sys.user.mapper;

import com.tianruan.dc.modules.sys.user.entity.dto.ConsultationDTO;
import com.tianruan.dc.modules.sys.user.entity.dto.TutorSolutionDTO;
import com.tianruan.dc.modules.userinfo.entity.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

/**
 * @date 2024/1/28
 */

@Mapper
public interface ConsultationMapper {

    /**
     * 插入咨询内容
     * @param consultationDTO
     */
    void insert(ConsultationDTO consultationDTO);

    /**
     * 删除咨询数据
     * @param id
     */
    @Delete("delete from iflytek_study_platform.t_ipa_consultation where id = #{id}")
    void deleteConsultation(String id);
    @Delete("delete from iflytek_study_platform.t_ipa_consultation_solution where consultation_id = #{id}")
    void deleteSolution(String id);

    /**
     * 根据id查询咨询数据
     * @param id
     * @return
     */
    ConsultationDTO getById(String id);

    /**
     * 修改咨询
     * @param consultationDTO
     */
    void update(ConsultationDTO consultationDTO);

    /**
     * 咨询分页查询
     */
    List<ConsultationDTO> page(Integer page, Integer pageSize, String project_brief, String question,
                               String create_by, Date startTime_C, Date endTime_C);


    /**
     * 解答记录分页查询
     */
    List<TutorSolutionDTO> list(Integer page, Integer pageSize, String project_brief, String create_by,
                                String createBy, Date startTime_C, Date endTime_C, Date startTime_S, Date endTime_S);

    /**
     * 根据id查询导师
     * @param id
     * @return
     */
    @Select("select * from iflytek_study_platform.t_sys_user_info where id = #{id}")
    User getTutorById(String id);

    /**
     * 根据用户id查询个人咨询与解答信息
     * @param user_name
     * @return
     */
    List<ConsultationDTO> getByUserId(String user_name);

}
